import type { addressResult } from '@/types/address'
import { http } from '@/utils/http'

// 获取、添加、删除、修改收货地址列表
export const addressListAPI = () => {
  return http<addressResult>({
    method: 'GET',
    url: `/member/address`,
  })
}
// 获取收货地址详情
export const getAddressByIdAPI = (id: string) => {
  return http<addressResult>({
    method: 'GET',
    url: `/member/address/${id}`,
  })
}
// 修改收货信息
export const getUpdateAddressAPI = (id: string, data: any) => {
  return http({
    method: 'PUT',
    url: `/member/address/${id}`,
    data,
  })
}

// 修改收货信息
export const getSetAddressAPI = (data: any) => {
  return http({
    method: 'POST',
    url: `/member/address`,
    data,
  })
}

//删除收货地址
export const getDeleteAddressAPI = (id: string) => {
  return http({
    method: 'DELETE',
    url: `/member/address/${id}`,
  })
}
